
*** send-down

import excel ../raw/Senddown/SDY_province.xlsx, sheet("Table 1") firstrow clear

compress

save ../raw/Senddown/SDY_province.dta, replace

* divie by 
use ../data/census1990individual, clear

tab prov, nol

drop if hukou == 1
* drop people with urban hukou

replace prov = 44 if prov == 46

keep if birthy >= 1962 & birthy <= 1979

collapse (count) n = hhcode, by(prov) fast

merge 1:1 prov using ../raw/Senddown/SDY_province.dta
drop _merge

list

replace n = n*100

foreach var of varlist sdy* {
	replace `var' = `var' * 1000
}

g sdyReceivedRatio = sdy_received_total / n
* ratio of the received send-down youths to the rural cohort size in 1962-1979

sum sdyReceivedRatio

keep prov sdyReceivedRatio

save ../temp/sdyReceivedRatio, replace



*** population loss
use ../data/census1990individual, clear

tab hukou

keep if hukou == 0

keep if birthy >= 1950 & birthy <= 1970

g byte fyear = birthy >= 1959 & birthy <= 1961

tab fyear

collapse (count) pop = hhcode, by(prov birthy fyear)

collapse (mean) pop, by(prov fyear)

reshape wide pop, i(prov) j(fyear)

g lossratio = (pop0 - pop1) / pop0

keep prov lossratio

save ../temp/census1990_famine, replace


*** Andrew Walder fatality

use ../raw/AndrewWalderCR/Xiandata7.3.dta, clear

recode province (1 = 34) (2 = 11) (3 = 35) (4 = 44) (5 = 62) ///
(6 = 45) (7 = 52) (8 = 13) (9 = 23) (10 = 41) ///
(11 = 42) (12 = 43) (13 = 22) (14 = 32) (15 = 36) ///
(16 = 21) (17 = 15) (18 = 64) (19 = 63) (20 = 61) ///
(21 = 51) (22 = 37) (23 = 31) (24 = 14) (26 = 65) ///
(27 = 53) (28 = 33) (29 = 54), g(prov)

replace prov = 12 if substr(caseid, 1, 2) == "TJ"
* Tianjing

drop if diqucode == "SH00" | diqucode == "BJ00"
* drop the prefecture-level city of Beijing and Shanghai

sum deaths

tab prov, m

collapse (sum) deaths totalpop, by(prov)

g CRdratio = deaths / totalpop * 100

sum

save ../temp/CRfatality, replace


*** minority
use ../data/census1990individual, clear

tab hukou

keep if hukou == 0

keep if birthy >= 1930 & birthy <= 1939

replace prov = 44 if prov == 46

drop if missing(han)

recode han (0 = 1)(1 = 0), g(min)

collapse (mean) minShare = min, by(prov) fast

sort minShare
list

replace minShare = minShare[_n + 1] if minShare == 0
* replace Shanghai's 0 with Jiangsu's smallest non-zero value

save ../temp/census1990_minShare, replace



*** gdp
use ../raw/ProvinceData/NewChinaSixtyYears.dta, clear

rename provcode prov

xtset prov year

g GDPgrowth = (GDP - L.GDP)/L.GDP

keep prov year GDPpc naturalGrowthRate GDPgrowth

distinct prov

drop if prov == 46 | prov == 50 | prov == 54

keep if year >= 1970 & year <= 1975

collapse (mean) gdpg = GDPgrowth gdppc = GDPpc popGrowth = naturalGrowthRate, by(prov)

sum

sum gdppc, d
local m = r(p50)

g gdppcHigh = gdppc > `m'

tab gdppcHigh

save ../temp/provMacro, replace


*** number of secondary school teachers ratio
use ../raw/ProvinceData/NewChinaSixtyYears.dta, clear

rename provcode prov

keep prov year nteacherSecondary nstudentSecondary

distinct prov

drop if prov == 46 | prov == 50 | prov == 54


g byear = year - 13

keep prov byear nteacherSecondary

sum byear

save ../temp/provSecondarySchool, replace


** CSL
use ../raw/ProvinceData/cel_ma.dta, clear
rename provcd prov
rename cohort cohort_cel
keep prov cohort_cel

save ../temp/provCEL, replace






